package com.gigmissions.client.ui;

import com.gigmissions.client.config.GigMissionsMessages;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.inject.Inject;
import com.google.inject.Singleton;

@Singleton
public class LoginSignupPanel extends HorizontalPanel {
	
	private Anchor anchor;
	private Label label;
	private GigMissionsMessages messages;
	
	public LoginSignupPanel(){
		
	}
	
	@Inject
	public LoginSignupPanel(GigMissionsMessages messages,Label label, Anchor anchor){
		super();
		this.anchor = anchor;
		this.label = label;
		this.messages = messages;
		setSpacing(3);
		add(this.getLabel());
		add(this.getAnchor());
		
	}
	
	public void showLoggedIn(String logoutUrl,String nickName){
		
		this.anchor.setText(messages.signOut());
		this.anchor.setHref(logoutUrl);
		this.label.setText(messages.welcome(nickName));
	}

	public void showLoggedOut(String loginUrl){
		
		anchor.setText(messages.loginSignup());
		anchor.setHref(loginUrl);
		label.setText(messages.homePanelText());
	}


	public Label getLabel() {
		return label;
	}



	public void setLabel(Label label) {
		this.label = label;
	}



	public Anchor getAnchor() {

		return anchor;
	}



	
	
	
	

}
